package com.example.miaosha.service.model;

import lombok.Data;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * Created by lerry_li on 2020/10/20
 */
@Data
public class ItemModel implements Serializable {
    private Integer id;

    //商品名称
    @NotBlank(message = "商品名称不能为空")
    private String title;

    //价格
    @NotNull(message = "商品价格不能不填写")
    @Min(value = 0, message = "商品价格必须大于0")
    private BigDecimal price;

    //库存
    @NotNull(message = "商品库存不能不填写")
    private Integer stock;

    //描述
    @NotBlank(message = "商品描述不能为空")
    private String description;

    //销量
    private Integer sales;

    //图片信息
    @NotBlank(message = "图片信息不能为空")
    private String imgURL;

    //使用聚合模型，若不为空，则表示拥有还未结束的秒杀活动
    private PromoModel promoModel;
}
